{include file="Public:header2"/}
<body style="min-height: 100%;background-color: #fff">
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form onsubmit="return false;">
                        <div class="layui-form" wid100 lay-filter="">
                            <div class="layui-form-item">
                                <label class="layui-form-label">账号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="username"  value="{$admin.username}"  autocomplete="off"  placeholder="请输入账号" class="layui-input" style="width: 600px">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">姓名</label>
                                <div class="layui-input-block">
                                    <input type="text" name="nickname" value="{$admin.nickname}" autocomplete="off"  placeholder="请输入姓名" class="layui-input" style="width: 600px">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="password" value=""  placeholder="请输入密码（不修改请留空）" class="layui-input" style="width: 600px">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">重复密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="repassword" value=""  placeholder="请输入重复密码（不修改请留空）" class="layui-input" style="width: 600px">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">管理员角色</label>
                                <div class="layui-input-inline">
                                    <select name="qid" lay-verify="">
                                        <option  value="0"  {if condition="$admin.qid eq 0"}selected{/if}>最高权限</option>
                                        {foreach name="quanxian" item="vo"}
                                        <option value="{$vo.id}" {if condition="$vo.id eq $admin.qid"}selected{/if}>{$vo.title}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <input type="hidden" name="id" value="{$admin.id}">
                                    <button class="layui-btn" onclick="return check()">确认保存</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="Public:footer"/}
</body>
</html>
<script type="text/javascript">
    layui.use(['layer','form'], function(){

    });

    function check(){
        var url="{:url('/admin/admin_edit')}";
        var $ = layui.$;
        var load=layer.load(2);
        $.post(url,$("form").serialize(),function(data){
            if(data.status==1){
                layer.msg(data.msg,{icon:1,time:1500},function(){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index);
                    parent.location.reload();
                });
            }else{
                layer.msg(data.msg,{icon:2,anim:6,time:1500},function(){
                    layer.close(load);
                });
            }
        })
    }
</script>
